// ignore_for_file: non_constant_identifier_names

class SendMsgFileData {
  String? type;
  String? url;
  String? transfer_method;

  SendMsgFileData({this.type, this.url, this.transfer_method});

  Map<String, dynamic> toJson() {
    return {
      "type": type,
      "url": url,
      "transfer_method": transfer_method,
    };
  }

  factory SendMsgFileData.fromJson(Map<String, dynamic> json) {
    return SendMsgFileData(
      type: json["type"],
      url: json["url"],
      transfer_method: json["transfer_method"],
    );
  }
}

class SendMsgModel {
  Map<String, dynamic> inputs;
  String query;
  String response_mode;
  String conversation_id;
  String user;
  List<SendMsgFileData> files;

  SendMsgModel({
    required this.inputs,
    required this.query,
    required this.response_mode,
    required this.conversation_id,
    required this.user,
    required this.files,
  });

  Map<String, dynamic> toJson() {
    return {
      "inputs": inputs,
      "query": query,
      "response_mode": response_mode,
      "conversation_id": conversation_id,
      "user": user,
      "files": files.map((e) => e.toJson()).toList(),
    };
  }

  factory SendMsgModel.fromJson(Map<String, dynamic> json) {

    List<SendMsgFileData> files = [];
    if (json['files'] != null){
      for (var e in json['files']){
        files.add(SendMsgFileData.fromJson(e));
      }
    }


    return SendMsgModel(
      inputs: json["inputs"],
      query: json["query"],
      response_mode: json["response_mode"],
      conversation_id: json["conversation_id"],
      user: json["user"],
      files: files,
    );
  }
//
}
